<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: cwh
 * @LastEditTime: 2022-01-09 19:12:04
-->
<template>
  <!--1. 容器 -->
<div ref="bottom2_container" style="height: 95%"></div>
</template>
<script>
import { get } from '../../../utils/request';
import { Bar } from '@antv/g2plot';
export default{
  data(){
    return{
      dataArr:[]
    }
  },
  mounted(){
    this.initData()
  },
  methods:{
    initData(){
      get('dashboard/queryMouthData').then(res=>{
        console.log(3333,res);
        this.dataArr = res.data
        this.initChart()
      })
    },
    initChart(){
      const bar = new Bar(this.$refs.bottom2_container,{
        data:this.dataArr,
        xField: 'value',
        yField: 'date',
        seriesField: 'date',
        legend:{
          position: 'top-left',
                },
      })

      bar.render()
    }
  }
}

</script>
